/*
 * @Descripttion: 首页 或者 个人中心页面展示设备信息
 * @version: 
 * @Author:Hui
 * @Date: 2022-02-10 14:48:34
 * @LastEditTime: 2025-07-05 16:13:09
 * @LastEditors: sueRimn
 */


import { mapGetters } from 'vuex'

import {
  wait
} from '@/utils'

export default {
  data() {
    return {
      addressInfo: {
        userName: '',
        userPhone: '',
        province: '',
        city: '',
        area: '',
        address: '',
      },
    }
  },

  computed: {
    ...mapGetters([
      'userInfo','shipping',"geoLocation"
    ])
  },

  methods: {
    async loadAddressInfo() {
      await wait(100)
      
      if(this.shipping.userName){
        this.addressInfo = this.shipping
        return;
      }

      if(this.geoLocation.province){
        this.addressInfo = this.geoLocation;
        // this.addressInfo.userName = this.userInfo.nickName||"用户",
        // this.addressInfo.userPhone = this.userInfo.phone
        return;
      }
    },
    async updateAddressInfo(payload) {
      await wait(100)
      this.addressInfo = payload
    }
  }
}